package com.finace.money.presenter;

import com.finace.money.data.bean.EmptyBean;
import com.finace.money.net.rto_rxbuild.RxHttpReponseCompat;
import com.finace.money.net.rto_subscriber.ProgressSubcriber;
import com.finace.money.presenter.contract.OpenAccountContract;

import javax.inject.Inject;

/**
 * Created by zhangpeng on 2018/1/26.
 */

public class OpenAccountPresenter extends BasePresenter<OpenAccountContract.IOpenAccountModel,OpenAccountContract.View>{

    @Inject
    public OpenAccountPresenter(OpenAccountContract.IOpenAccountModel iOpenAccountModel, OpenAccountContract.View view) {
        super(iOpenAccountModel, view);
    }

    public void checkPhone(String phone,String imgcode,String code){

        mModel.checkPhone(phone,imgcode,code).compose(RxHttpReponseCompat.<EmptyBean>compatResult())
                .subscribe(new ProgressSubcriber<EmptyBean>(mContext,mView) {
                    @Override
                    public void onNext(EmptyBean emptyBean) {
                        if(hasView()){
                            mView.checkSucess();
                        }
                    }
                });
    }
}
